Skip to content

feat(fs): read archives through the one read path - #21

Open
Steel-tech wants to merge 1 commit into
mainfrom
claude/best-in-class-github-commit-ksgga0
Open

feat(fs): read archives through the one read path#21
Steel-tech wants to merge 1 commit into
mainfrom
claude/best-in-class-github-commit-ksgga0

Conversation

@Steel-tech

Copy link
Copy Markdown
Contributor

The last light decoder in the read series (files → directories → URLs → SQLite → now archives).

read_file on a zip, tar, or gzipped tar — recognized by magic bytes (PK headers, gzip's 1f 8b, ustar at offset 257), never extension — renders an entry listing like a directory read: names, sizes, directories with trailing slashes. Passing entry extracts one member instead, rendered as ordinary hashline text.

Bounded on purpose:

  • the listing caps at 1000 entries with the true total reported;
  • extraction caps at 256 KiB while streaming, so a small archive that inflates enormously stops at the cap instead of filling memory — the zip-bomb test compresses 1 MiB of as and asserts the read stops exactly at the cap with a clipped marker.

A missing entry is an InvalidInput pointing back at the listing, not a guess. Misleading extensions go both ways in the tests: a zip named .txt reads as an archive, a text file named .zip reads as text.

Deps: zip (default-features off, deflate only), tar, flate2 — all pure Rust.

Validation: unit tests for detection, listings, extraction, caps, and misses on all three formats, plus an integration test through read_file (listing → entry as hashline). Full gates green ×2 — fmt, clippy -D warnings, workspace tests (200 tests).

🤖 Generated with Claude Code

https://claude.ai/code/session_01KoSjfcJPjXpkVLTS2Vxwwr


Generated by Claude Code

Zip, tar, and gzipped tar are recognized by their magic bytes — never
their extensions — and render as an entry listing like a directory
read. Passing `entry` extracts one member instead, rendered as hashline
text like any file.

Everything is bounded: the listing caps its entry count with the true
total reported, and extraction caps its bytes while streaming, so a
small archive that inflates enormously stops at the cap instead of
filling memory — zip bombs stay in the bottle.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoSjfcJPjXpkVLTS2Vxwwr
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Steel-tech, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6e1fe563-5084-4ed7-b182-c4e58520aa0e

📥 Commits

Reviewing files that changed from the base of the PR and between 2f8e7a7 and d9e9b73.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • Cargo.toml
  • README.md
  • crates/tools/Cargo.toml
  • crates/tools/src/archive.rs
  • crates/tools/src/fs.rs
  • crates/tools/src/lib.rs
  • docs/TOOLS.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants